<?php

namespace App\Entity\Banner;

use ApiPlatform\Core\Annotation\ApiResource;
use App\Base\Annotation\Common;
use App\Repository\Banner\IconsRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;

/**
 * @ApiResource()
 * @ORM\Entity(repositoryClass=IconsRepository::class)
 */
class Icons
{
    /**
     * @Common(cnName="#",listType="text",editType="text")
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     * @Groups({"banner"})
     */
    private $id;

    /**
     * @Common(cnName="标题",listType="pic",editType="text",width="")
     * @ORM\Column(type="string", length=255, nullable=true)
     * @Groups({"banner"})
     */
    private $title;

    /**
     * @Common(cnName="图片",listType="pic",editType="pic",width="300")
     * @ORM\Column(type="string", length=255, nullable=true)
     * @Groups({"banner"})
     */
    private $pic;

    /**
     * @Common(cnName="顺序",listType="text",editType="text")
     * @ORM\Column(type="integer", nullable=true)
     * @Groups({"banner"})
     */
    private $sorts;

    /**
     * @Common(cnName="参数",listType="text",editType="arrayText")
     * @ORM\Column(type="array", nullable=true)
     * @Groups({"banner"})
     */
    private $params = [];

    /**
     * @Common(cnName="板块",listType="text",editType="select",width="240")
     * @ORM\ManyToOne(targetEntity=BannerPosition::class, inversedBy="banners")
     * @Groups({"banner"})
     */
    private $position;

    /**
     * @Common(cnName="动作",listType="text",editType="select",width="200")
     * @ORM\ManyToOne(targetEntity=BannerAction::class, inversedBy="banners")
     * @Groups({"banner"})
     */
    private $action;

    /**
     * @Common(cnName="背景色",listType="text",editType="text",width="240")
     * @ORM\Column(type="string", length=255, nullable=true)
     * @Groups({"banner"})
     */
    private $color;

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getTitle(): ?string
    {
        return $this->title;
    }

    public function setTitle(?string $title): self
    {
        $this->title = $title;

        return $this;
    }

    public function getPic(): ?string
    {
        return $this->pic;
    }

    public function setPic(?string $pic): self
    {
        $this->pic = $pic;

        return $this;
    }

    public function getSorts(): ?int
    {
        return $this->sorts;
    }

    public function setSorts(?int $sorts): self
    {
        $this->sorts = $sorts;

        return $this;
    }

    public function getParams(): ?array
    {
        return $this->params;
    }

    public function setParams(?array $params): self
    {
        $this->params = $params;

        return $this;
    }

    public function getPosition(): ?BannerPosition
    {
        return $this->position;
    }

    public function setPosition(?BannerPosition $position): self
    {
        $this->position = $position;

        return $this;
    }

    public function getAction(): ?BannerAction
    {
        return $this->action;
    }

    public function setAction(?BannerAction $action): self
    {
        $this->action = $action;

        return $this;
    }

    public function getColor(): ?string
    {
        return $this->color;
    }

    public function setColor(?string $color): self
    {
        $this->color = $color;

        return $this;
    }
}
